<%--
  Created by IntelliJ IDEA.
  User: 陈帅玺
  Date: 2018-12-28
  Time: 19:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <title>登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="${path}/layui/css/layui.css">
    <link rel="stylesheet" href="${path}/assets/css/loader-style.css">
    <link rel="stylesheet" href="${path}/assets/css/bootstrap.css">
    <link rel="stylesheet" href="${path}/assets/css/signin.css">
    <script type="text/javascript" src="${path}/assets/js/jquery.js"></script>
    <script type="text/javascript" src="${path}/assets/js/preloader.js"></script>
    <script type="text/javascript" src="${path}/assets/js/bootstrap.js"></script>
    <script type="text/javascript" src="${path}/assets/js/load.js"></script>
    <script src="${path}/layui/layui.js"></script>
    <link rel="shortcut icon" href="/assets/ico/minus.png">
    <style>
        .form-control{
            padding: 6px 1px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div id="login-wrapper">
            <div class="row">
                <div class="col-md-4 col-md-offset-4">
                    <div id="logo-login">
                        <h1 class="text-center">
                            客户销售管理系统
                        </h1>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-4 col-md-offset-4">
                    <div class="account-box">
                        <form class="layui-form" id="login"  action="" method="post">
                            <div class="form-group">
                                <label for="ele_account">用户名</label>
                                <input type="text" autocomplete="off" id="ele_account" autofocus class="form-control" name="username">
                            </div>
                            <div class="form-group">
                                <label for="password">密码</label>
                                <input type="password" autocomplete="off" id="password" class="form-control" name="password">
                            </div>
                            <button onclick="sub(); return false;" lay-submit lay-filter="login" class="btn btn-primary pull-right">登 录</button>
                        </form>
                        <a class="forgotLnk" href="box/index.html"></a>
                        <div class="row-block">
                            <div class="row"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        layui.use('layer');
        function sub() {
            var username=$("#ele_account").val();
            var password=$("#password").val();
            if(username==null || username =="" && password==null || password==""){
               layer.msg("用户名或密码不能为空...",{icon:5});
            }else{
                var login=$("#login").serialize();
                $.post("${pageContext.request.contextPath}/User/login",login,function (data) {
                    if(data.code!=0){
                        layer.msg(data.msg,{icon:5});
                    }else{
                        layer.msg("登陆成功",{icon:1,time:800},function () {
                            location.href="${path}/User/main";
                        });
                    }
                })
            }
        }
    </script>

</body>
</html>
